<template>
  <a-result status="404" title="404" sub-title="抱歉!你访问的页面不存在!">
    <template #extra>
      <a-button type="primary" v-on:click="backHome"> 返回首页 </a-button>
      <a-button type="primary" v-on:click="goBack"> 返回上一页 </a-button>
    </template>
  </a-result>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import { Result } from 'ant-design-vue';
import { useRouter } from 'vue-router';

export default defineComponent({
  components: {
    [Result.name]: Result,
  },
  setup() {
    const router = useRouter();
    const backHome = () => {
      router.push('/');
    };
    const goBack = () => {
      router.back();
    };
    return {
      backHome,
      goBack,
    };
  },
});
</script>

<style scoped></style>
